package com.wise.logbackl.filters;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

public class CustomerFilter extends Filter<ILoggingEvent> {
    @Override
    public FilterReply decide(ILoggingEvent iLoggingEvent) {
        System.out.println("the message is:" + iLoggingEvent.getMessage());
        System.out.println("and the regex matches result:" + iLoggingEvent.getMessage().matches("^\\d{11}\\|.+$"));
        if (iLoggingEvent.getMessage().matches("^\\d{11}\\|.+$")) {
            return FilterReply.ACCEPT;
        } else {
            return FilterReply.DENY;
        }
    }
}
